package com.controller;

import com.dto.excution.ListExcution;
import com.enums.ListEnum;
import com.service.AdviceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2019/1/2 0002.
 */
@RequestMapping("/advice")
@RestController
public class AdviceController {
    @Autowired
    private AdviceService service;

    /**
     * 新增投诉单
     * @param userId  用户内码
     * @param phone  手机号
     * @param title  标题
     * @param content 内容
     * @return
     */
    @ApiOperation(value = "新增投诉单")
    @PostMapping(value = "/insertAdvice")
    @ResponseBody
    public ListExcution<Void> insertAdvice(Integer userId,String phone,String title,String content){
       int success = service.insertAdvice(userId,phone,title,content);
        if(success > 0){
            return new ListExcution<Void>(null, ListEnum.ADDSUCCESS);
        }else{
            return new ListExcution<Void>(null, ListEnum.ADDFAIL);
        }
    }

}
